import { computed } from 'vue';

import { useAppStore } from '@/store/modules/app';

/**
 * @description 多 tab 设置方法
 * @example
 */
export function useMultipleTabSetting() {
  const appStore = useAppStore();

  // 是否开启多 tab
  const getShowMultipleTab = computed(() => appStore.getMultiTabsSetting.show);
  // 开启快速操作
  const getShowQuick = computed(() => appStore.getMultiTabsSetting.showQuick);
  // 是否显示刷新那妞
  const getShowRedo = computed(() => appStore.getMultiTabsSetting.showRedo);
  // 是否显示折叠按钮 标签过多会右侧折叠起来会有一个框展示
  const getShowFold = computed(() => appStore.getMultiTabsSetting.showFold);

  // 更新多 tab 的设置方法
  function setMultipleTabSetting(multiTabsSetting: any) {
    appStore.setProjectConfig({ multiTabsSetting });
  }
  return {
    setMultipleTabSetting,
    getShowMultipleTab,
    getShowQuick,
    getShowRedo,
    getShowFold
  };
}
